package com.sskj.hangqing.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.hangqing.bean.GuideListBean;
import com.sskj.hangqing.http.HttpConfig;
import com.sskj.hangqing.ui.fragment.HangqingFragment;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonCallBack;

import java.util.List;


public class HangqingFragmentPresenter extends BasePresenter<HangqingFragment> {


    public void getBanner() {
        httpService.getBanner()
                .execute(new JsonCallBack<HttpData<List<String>>>() {
                    @Override
                    public void onSuccess(Response<HttpData<List<String>>> response) {
                        HttpData<List<String>> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {

                            mView.updateBanner(httpData.getData());
                        }
                    }
                });
    }

    public void getNotice() {
        httpService.getNotice()
                .execute(new JsonCallBack<HttpData<PageBean<GuideListBean>>>() {
                    @Override
                    public void onSuccess(Response<HttpData<PageBean<GuideListBean>>> response) {
                        HttpData<PageBean<GuideListBean>> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {

                            mView.updateNotice(httpData.getData().getList());

                        }
                    }
                });
    }


}
